/*
 * Copyright 2013-2018 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.huiyun.project.im.server.client.feign;

import com.huiyun.project.common.core.constant.SecurityConstants;
import com.huiyun.project.common.core.domain.R;
import com.huiyun.project.im.consts.ServiceNameConst;
import com.huiyun.project.im.entity.ImUser;
import org.jim.core.packets.pub.pojo.JimUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(contextId = "remoteUserService", value = ServiceNameConst.IM_SERVER_SERVICE)
public interface RemoteUserService {

    /**
     * rest登陆后有个token,通过token获取用户信息
     *
     * @param token
     * @return
     */
    @GetMapping("/sv/user/getUserByToken")
    R<JimUser> getUserByToken(@RequestHeader("ImAuthorization") String token, @RequestHeader(SecurityConstants.FROM) String from);

    /**
     * 通过用户名密码等执行登陆逻辑并获取用户信息
     */
    @GetMapping("/sv/user/getUserByForm")
    R<JimUser> getUserByForm(@RequestParam("appKey") String appKey, @RequestParam("username") String username,
                             @RequestParam("password") String password, @RequestParam("device") String device,
                             @RequestParam("devicePlatform") String devicePlatform, @RequestParam("deviceId") String deviceId, @RequestHeader(SecurityConstants.FROM) String from);

    /**
     * 获取租户下的客服列表
     *
     * @return
     */
    @GetMapping("/sv/user/getCsList")
    R<List<ImUser>> getCsList(@RequestParam("imTenantId") String imTenantId, @RequestParam("agentOrgId") String userOrgId, @RequestHeader(SecurityConstants.FROM) String from);


}
